package com.esri.core.symbol;

import android.graphics.Color;
import com.esri.core.internal.util.d;
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonNode;
import org.codehaus.jackson.map.ObjectMapper;

/* loaded from: classes.dex */
public abstract class FillSymbol implements Symbol {
    private static final long serialVersionUID = 1;
    int a;
    LineSymbol b;

    public FillSymbol(JsonNode jsonNode) throws Exception {
        this.a = Color.argb(0, 0, 0, 0);
        this.b = new SimpleLineSymbol(-16777216, 1.0f);
        this.a = d.b(jsonNode, "color", this.a);
        JsonNode jsonNode2 = jsonNode.get("outline");
        if (jsonNode2 != null) {
            this.b = new SimpleLineSymbol(jsonNode2);
        }
    }

    public FillSymbol() {
        this.a = Color.argb(0, 0, 0, 0);
        this.b = new SimpleLineSymbol(-16777216, 1.0f);
    }

    public int getColor() {
        return this.a;
    }

    public FillSymbol setColor(int i) {
        this.a = i;
        return this;
    }

    public int getAlpha() {
        return Color.alpha(this.a);
    }

    public FillSymbol setAlpha(int i) {
        this.a = (i << 24) | (this.a & 16777215);
        return this;
    }

    public LineSymbol getOutline() {
        return this.b;
    }

    public FillSymbol setOutline(LineSymbol lineSymbol) {
        this.b = lineSymbol;
        return this;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public void a(JsonGenerator jsonGenerator) throws Exception {
        d.b(jsonGenerator, "color", this.a);
        if (this.b != null) {
            jsonGenerator.writeFieldName("outline");
            jsonGenerator.writeRaw(':');
            jsonGenerator.writeRaw(this.b.toJson());
        }
    }

    public static FillSymbol fromJson(String str) throws Exception {
        if (str != null && !str.isEmpty()) {
            JsonNode readValueAsTree = new ObjectMapper().getJsonFactory().createJsonParser(str).readValueAsTree();
            if (str.contains(SimpleFillSymbol.TYPE)) {
                return new SimpleFillSymbol(readValueAsTree);
            }
            if (str.contains(PictureFillSymbol.TYPE)) {
                return new PictureFillSymbol(readValueAsTree);
            }
        }
        return null;
    }

    public int hashCode() {
        int i = (this.a + 31) * 31;
        LineSymbol lineSymbol = this.b;
        return i + (lineSymbol == null ? 0 : lineSymbol.hashCode());
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj != null && getClass() == obj.getClass()) {
            FillSymbol fillSymbol = (FillSymbol) obj;
            if (this.a != fillSymbol.a) {
                return false;
            }
            LineSymbol lineSymbol = this.b;
            if (lineSymbol == null) {
                if (fillSymbol.b != null) {
                    return false;
                }
            } else if (!lineSymbol.equals(fillSymbol.b)) {
                return false;
            }
            return true;
        }
        return false;
    }
}
